home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.text.html;
-
- import javax.swing.JEditorPane;
- import javax.swing.text.DefaultStyledDocument;
- import javax.swing.text.Document;
- import javax.swing.text.EditorKit;
- import javax.swing.text.Element;
- import javax.swing.text.JTextComponent;
- import javax.swing.text.StyleConstants;
- import javax.swing.text.StyledEditorKit;
-
- public abstract class HTMLEditorKit$HTMLTextAction extends StyledEditorKit.StyledTextAction {
- public HTMLEditorKit$HTMLTextAction(String var1) {
- super(var1);
- }
-
- protected int elementCountToTag(HTMLDocument var1, int var2, HTML.Tag var3) {
- int var4 = -1;
-
- Element var5;
- for(var5 = ((DefaultStyledDocument)var1).getCharacterElement(var2); var5 != null && var5.getAttributes().getAttribute(StyleConstants.NameAttribute) != var3; ++var4) {
- var5 = var5.getParentElement();
- }
-
- return var5 == null ? -1 : var4;
- }
-
- protected Element findElementMatchingTag(HTMLDocument var1, int var2, HTML.Tag var3) {
- Element var4 = ((DefaultStyledDocument)var1).getDefaultRootElement();
-
- Element var5;
- for(var5 = null; var4 != null; var4 = var4.getElement(var4.getElementIndex(var2))) {
- if (var4.getAttributes().getAttribute(StyleConstants.NameAttribute) == var3) {
- var5 = var4;
- }
- }
-
- return var5;
- }
-
- private Element[] getElementsAt(Element var1, int var2, int var3) {
- if (var1.isLeaf()) {
- Element[] var5 = new Element[var3 + 1];
- var5[var3] = var1;
- return var5;
- } else {
- Element[] var4 = this.getElementsAt(var1.getElement(var1.getElementIndex(var2)), var2, var3 + 1);
- var4[var3] = var1;
- return var4;
- }
- }
-
- protected Element[] getElementsAt(HTMLDocument var1, int var2) {
- return this.getElementsAt(((DefaultStyledDocument)var1).getDefaultRootElement(), var2, 0);
- }
-
- protected HTMLDocument getHTMLDocument(JEditorPane var1) {
- Document var2 = ((JTextComponent)var1).getDocument();
- if (var2 instanceof HTMLDocument) {
- return (HTMLDocument)var2;
- } else {
- throw new IllegalArgumentException("document must be HTMLDocument");
- }
- }
-
- protected HTMLEditorKit getHTMLEditorKit(JEditorPane var1) {
- EditorKit var2 = var1.getEditorKit();
- if (var2 instanceof HTMLEditorKit) {
- return (HTMLEditorKit)var2;
- } else {
- throw new IllegalArgumentException("EditorKit must be HTMLEditorKit");
- }
- }
- }
-